﻿var virualpath ="../../"
$(function () {

  
    GetMp4()
})
function GetMp4() {
    $("#VideoList").empty()
    var Name = $("#Name").val();
    if (Name == undefined) {
        Name = "";
    }
    var obj = {};
    obj.Name = Name;
    $.ajax({
        url: virualpath + '/Search/GetProMp4ByNameinfo',
        type: 'get',
        data: obj,
        async: true,
        dataType: 'json',
        contentType: 'application/json',
        success: function (data) {
            var resultData = data;
            if (resultData != undefined) {
                var Str = "";
                for (var i = 0; i < Object.keys(resultData).length; i++) {
                    if (resultData[i].Pro_VideoUrl != "" || resultData[i].Pro_VideoUrl != null || resultData[i].Pro_VideoUrl != undefined) {
                        Str += '<div id="d' + resultData[i].Id + '" class="onelist color2" onclick="ProLocation(' + resultData[i].Id + ')"><div class="onelistin"><div class="fg_info"><p class="facetitp4">' + resultData[i].Pro_Name + '</p><p class="facetitp5">主讲教师：' + resultData[i].TName + '</p><p class="facetitp6">' + resultData[i].Company + resultData[i].Position + '</p><div class="btn_box"><a class="btn_enter">开始学习</a></div></div><div class="pic"><img src="' + resultData[i].Pro_Filepath + resultData[i].Pro_BackImg + '" /></div><div class="info_s"><div class="oneinfo time"><b></b>' + resultData[i].Pro_Videomin + '</div><div class="oneinfo love"><b></b>' + resultData[i].Pro_LikeNumber + '</div><div class="oneinfo user"><b></b>' + resultData[i].Pro_BrowseNumber + '</div></div><div class="info_b"><div class="college">' + resultData[i].Pro_Name + '</div><div class="teacher"></div><div class="topic">' + resultData[i].Pro_Name + '</div><div class="subject">所属课目：' + resultData[i].Pro_Name + ' </div></div></div></div>';
                    }
                }
                $("#VideoList").append(Str);
            }
        }
    })
    $.ajax({
        url: virualpath + '/Search/GetCourseMp4ByNameinfo',
        type: 'get',
        data: obj,
        async: true,
        dataType: 'json',
        contentType: 'application/json',
        success: function (data) {
            var resultData = data;
            if (resultData != undefined) {
                var Str = "";
                for (var i = 0; i < Object.keys(resultData).length; i++) {
                    if (resultData[i].Course_VideoUrl != "" || resultData[i].Course_VideoUrl != null || resultData[i].Course_VideoUrl != undefined) {
                        Str += '<div id="dd' + resultData[i].Id + '" class="onelist color1" onclick="CourseLocation(' + resultData[i].Id + ',' + resultData[i].ProId + ')"><div class="onelistin"><div class="fg_info"><div class="teaface"><img src="' + resultData[i].Course_Filepath + resultData[i].Course_VideoImg + '" /></div><p class="facetitp">' + resultData[i].Course_Name + '</p><p class="facetitp2">主讲教师：' + resultData[i].TName + '</p><span class="facetitp3">' + resultData[i].Company + '<br>' + resultData[i].Section + '</span><div class="btn_box"><a class="btn_enter">开始学习</a></div></div><div class="pic"><img src="' + resultData[i].Course_Filepath + resultData[i].Course_BackImg+'" /></div><div class="info_s"><div class="oneinfo time"><b></b>' + resultData[i].Course_Videomin + '</div><div class="oneinfo love"><b></b>' + resultData[i].Course_LikeNumber + '</div><div class="oneinfo user"><b></b>' + resultData[i].Course_BrowseNumber + '</div></div><div class="info_b"><div class="college">' + resultData[i].Company + '</div><div class="teacher"></div><div class="topic">' + resultData[i].Course_Name + '</div><div class="subject">所属课目：' + resultData[i].PName + ' </div></div></div></div>';
                    }
                   
                }
                $("#VideoList").append(Str);
            }
        }
    })
}

function ProLocation(id) {
    location.href = "Project.html?id=" + id + "";
}

function CourseLocation(id,ProId) {
    location.href = "Course.html?id=" + id + ",ProId=" + ProId + "";
}